<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
    .current{
        color: coral;
    }
    .fs{
        font-size: 30px;
    }
    </style>
</head>
<body>
    <p id="test">hello world</p>
    <script>
        /*ele.style.cssAttr
        ele.className
        ele.style.cssText

        ele.classList 获取的是一个class的集合
        ele.classList.add()
        ele.classList.remove()
        ele.classList.toggle()--->在add和remove之间切换
        ele.classList.contains()-->是否包含某个class，结果返回boolean值 */
        var test=document.getElementById("test");
        test.onclick=function(){
        // this.style.backgroundColor ="#0EA432"
        // this.className="current";
        // this.style.cssText = "color:pink;font-size:90px;background-color:blue"
        // this.classList.add("fs");
        // this.classList.remove("current");
        this.classList.toggle("current");
        console.log(this.classList.contains("current"));
    }
    </script>
</body>
</html>